package com.tianyuan.dplrf.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.hjq.base.BaseAdapter;
import com.tianyuan.dplrf.R;
import com.tianyuan.dplrf.app.AppAdapter;

public class HomePageAdapter extends AppAdapter<Integer> {
    public HomePageAdapter(@NonNull Context context) {
        super(context);
        addItem(R.drawable.img_homeback);
        addItem(R.drawable.tianyuan_mainback);
    }

    @NonNull
    @Override
    public BaseAdapter<?>.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends BaseAdapter.ViewHolder{

        private ImageView img_item;

        public ViewHolder() {
            super(R.layout.adapter_onepicitem);
            img_item = (ImageView) getItemView();
        }

        @Override
        public void onBindView(int position) {
            img_item.setImageResource(getItem(position));
        }
    }
}
